{% extends "base.jinja" %}

{% block title %}{{share.title}}_{{share.cate.name}}_{% endblock %}
{% block keywords %}{{share.cate.name}}{% if keyword %},{{keyword|join(',')|replace('"','')}}{% endif %}{% endblock %}
{% block description %}{{share.content|cut_str(60)|replace('　', '')|replace('&nbsp;', '')}}{% endblock %}

{% block css %},main.css{% endblock %}
{% block focussign %}focussign{% endblock %}
{% block pagetype %}ext-detail{% endblock %}

{% block main %}
    <div class="layout mt-crumb">
        {% if edit_enable %}
        <div class="det-option">
            <a class="det-opt-del" data-require="sign" href="javascript:;" data-sid="{{share.id}}" id="det-delete" title="删除">删除</a>
            <a class="det-opt-edit" data-require="sign" href="{{domain}}share/edit/{{share.id}}/" title="编辑">编辑</a>
            {%if is_admin %}
                {%if share.is_recommend%}
                <a class="det-opt-stared" href="javascript:;" data-sid="{{share.id}}" title="取消推荐" id="det-recommend">取消推荐</a>
                {%else%}
                <a class="det-opt-star" href="javascript:;" data-sid="{{share.id}}" title="推荐" id="det-recommend">推荐</a>
                {%endif%}
                <a id="mark-origin" data-sid="{{share.id}}" class="ui-a det-opt-mark" data-require="sign" href="javascript:;" title="标注来源">标注来源</a>
            {%endif%}
        </div>
        {% endif %}
        <a href="{{domain}}">首页</a>&nbsp;>&nbsp;<h2><a target="_blank" href="{{domain}}share/cate/{{share.cate.id}}/">{{share.cate.name}}</a></h2>&nbsp;>&nbsp;<b>帖子详情</b>
    </div>

    <div class="layout page">
        <div class="ed-main edm-loading" id="ed-main">
            <div class="det-summary">
                <h1>{{share.title}}</h1>
                {% if supplier_data %}
                    <div class="det-note"><span>by <a target="_blank" href="{{domain}}su/{{share.user.id}}/">{{supplier_data.company}}</a></span>{{share.post_date|date('Y/m/d')}}</div>
                {% else %}
                    <div class="det-note"><span>by <a id="ed-main-auth" data-authuid="{{share.user.id}}" data-auth="{{share.user.username}}" target="_blank" href="{{domain}}u/{{share.user.id}}/">{{share.user.username}}</a></span>{{share.post_date|date('Y/m/d')}}</div>
                {% endif  %}
                {% if origin %}
                <input id="weibo-origin" type="hidden" value="【by {% for ori in origin %}@{{ori.user}}{% if not loop.last%},{% endif %}{% endfor %}】" />
                {% endif %}
                <div class="det-cont">
                    <img class="det-cont-cover" alt="{{share.title|safe}}" src="{{cover_data.cover.path}}!650" alt="{{share.title}}" />
                    {% autoescape off %}{{share.content}}{% endautoescape %}
                </div>
                {% if origin %}
                <ul class="ed-origin" id="ds-flag">
                    {% for ori in origin %}
                        <li data-user="{{ori.user}}">{{ori.role}}：<span>{{ori.user}}</span></li>
                    {% endfor %}
                </ul>
                {% endif %}

                <div class="det-opt">
                    {% if share.scheduled_enbale %}
                        <a data-require="sign" data-pid="{{share.id}}" data-suppliername="{{share.user.username}}" data-supplier="{{share.user.id}}" id="det-reserve" class="ui-a det-reserve" href="javascript:;">预约</a>
                    {% endif %}
                    <a data-require="sign" data-sid="{{share.id}}" id="d-like" class="ui-a det-like" href="javascript:;"></a>
                </div>

                <div id="ds-shareto" class="shareto">
                    <h6>分享：</h6>
                    <div class="sto-box">
                        <input type="hidden" name="author" value="{{share.user}}" />
                        <input type="hidden" name="title" value="#{{share.cate.name}}#{{share.title|forceescape}}" />
                        <input type="hidden" name="url" value="{{domain}}share/detail/all/{{share.id}}" />
                        <input type="hidden" name="multi" value="{%for img in images%}{{img.path}}!650{%if not loop.last %},{%endif %}{%endfor%}" />
                        {% if not share.combo_path == '' %}
                        <input type="hidden" name="combo" value="{{share.combo_path}}!650" />
                        {% else %}
                        <input type="hidden" name="combo" value="{{cover_data.cover.path}}!650" />
                        {% endif %}
                        <span class="sto-wx" title="分享到微信"><a target="_blank" href="/share/detail/weixin/?sid={{share.id}}"></a><em>微信</em></span>
                        <span class="sto-tsina" title="分享到新浪微博"></span>
                        <!--span class="sto-weikan" title="分享到微刊"></span-->
                        <span class="sto-huaban" title="分享到花瓣"></span>
                        <span class="sto-duitang" title="分享到堆糖"></span>
                        <span class="sto-diandian" title="分享到点点"></span>
                        <span class="sto-tqq" title="分享到腾讯微博"></span>
                        <span class="sto-rrzhan" title="分享到人人小站"></span>
                        <span class="sto-sqq" title="分享给QQ好友"></span>
                        <span class="sto-baidu" title="添加到百度收藏"></span>
                        <span class="sto-qzone" title="分享到QQ空间"></span>
                        <span class="sto-douban" title="分享到豆瓣"></span>
                        <span class="sto-tqf" title="分享到朋友网"></span>
                        <span class="sto-renren" title="分享到人人"></span>
                        <span class="sto-ty" title="分享到天涯社区"></span>
                    </div>
                    <a class="sto-more" href="javascript:;">更多</a>
                </div>
            </div>

            <div id="share" data-wf="none" data-shareid="{{share.id}}" {% if share.user.group_id==3 %}data-supplier="1"{%endif%} {% if share.scheduled_enbale %}data-reservenbale="1"{%endif%}>
                <ul class='share'>
                    <li class="ed-cover ed-cover-loading" data-mid="{{cover_data.cover.id}}">
                        <a class="s-link" href="{{domain}}share/detail/all/{{share.id}}/#m{{cover_data.cover.id}}">
                            <img src="http://s.lovewith.me/static/images/blank.gif" data-cover="{{cover_data.cover.path}}!650" alt="{{share.title|safe}}" />
                        </a>
                        {% if cover_data.sale_data %}
                        <a href="{{domain}}share/detail/all/{{share.id}}/#m{{cover_data.cover.id}}" class="ui s-sale"></a>
                        {% endif %}
                        {% if share.is_video %}
                            <a href="javascript:;" class="ui ed-video" data-video="{{share.video}}" title="播放视频"></a>
                        {% endif %}
                        <div class="s-ext">
                            <p><a href="{{domain}}share/detail/all/{{share.id}}/#m{{cover_data.cover.id}}">{{share.title|safe|cut_str(32)}}</a></p>
                        </div>
                    </li>
                    {% for img in images %}
                        {% if not img.is_cover %}
                        <li data-mid="{{img.id}}">
                            <a class="s-link" href="{{domain}}share/detail/all/{{share.id}}/#m{{img.id}}">
                                <img alt="{{share.title|safe}}" src="http://s.lovewith.me/static/images/blank.gif" data-origin="{{img.path}}!260" width="260" /></a>
                            {% if is_admin %}
                                <a class="ui s-del" data-mid="{{img.id}}" data-require="sign" href="javascript:;" alt="删除灵感" data-sid="{{share.share_id}}"></a>
                            {% endif %}
                            {% if img.sale_data %}
                            <a href="{{domain}}share/detail/all/{{share.id}}/#m{{img.id}}" class="ui s-sale"></a>
                            {% endif %}
                            <div class="s-ext">
                                <p><a href="{{domain}}share/detail/all/{{share.id}}/#m{{img.id}}">{{share.title|safe|cut_str(32)}}</a></p>
                            </div>
                        </li>
                        {% endif %}
                    {% endfor %}
                </ul>
            </div>
        </div>
        
        <div class="det-comm" id="det-comm" data-sid="{{share.id}}">
            <h5><span>评论</span></h5>
            <div class="dc-post">
                <div class="dc-cont"><textarea class="inp-atext" placeholder="输入评论内容"></textarea></div>
                <div class="dc-sm"><a class="inp-btn-pk d-btn" href="javascript:;" data-require="sign">发 表</a></div>
                <div class="dc-sync">
                    <a data-type="syncWb" class="dc-sync-wb dc-sync-wb-active" href="javascript:;" title="同步到新浪微博"></a>
                    <a data-type="syncQq" class="dc-sync-qq dc-sync-qq-active" href="javascript:;" title="同步到腾讯微博"></a>
                </div>
            </div>
            <div class="dc-item">
                <ul></ul>
                <div class="s-more"><a href="javascript:;">更多<span class="dc-total"></span>评论</a></div>
            </div>
        </div>

        <div class="share d-command" id="d-command">
            <h5><span>猜你也喜欢</span></h5>
            <ul>
                {% for share in guess_data.get('share') %}
                <li data-mid="{{share.cover_id}}">
                    <a target="_blank" class="s-link" href="{{domain}}share/detail/all/{{share.share_id}}/" {% if share.background %} style="background:{{share.background}};opacity:0.5;"{% endif %}>
                        <img alt="{{share.title}}" src="http://s.lovewith.me/static/images/blank.gif" data-src="{{share.cover}}!260" height="200" width="260"/>
                    </a>
                    <div class="s-ext">
                        <p title="{{share.title|forceescape}}"><a target="_blank" href="{{domain}}share/detail/all/{{share.share_id}}/">{{share.title|safe|cut_str(32)}}</a></p>
                        <span class="s-ext-img">{{share.count}}P</span>
                    </div>
                    {% if share.reserve %}
                    <a href="{{domain}}share/detail/{{share.share_id}}/#m{{share.cover_id}}" class="ui s-reserve"></a>
                    {% else %}
                        {% if share.sale_data %}
                        <a href="{{domain}}share/detail/{{share.share_id}}/#m{{share.cover_id}}" class="ui s-sale"></a>
                        {% endif %}
                    {% endif %}
                </li>
                {% endfor %}
            </ul>
            <div class="s-more"><a href="{{domain}}share/cate/{{share.cate.id}}">更多..</a></div>
        </div>
    </div>
{% endblock %}

{% block script %}
<script>seajs.use('page/detail-full', function(p){p.render()});</script>
<script type='text/javascript' defer='defer' charset='utf8'>(function(d,t){window.huaban_minWidth=100,window.huaban_minHeight=100;var appendScript=function(){var a=d.createElement("script");a.id="huaban_share_script";a.async=true;a.setAttribute("charset","utf-8");a.setAttribute("data-suspended","in");a.setAttribute("data-color","white");a.setAttribute("data-size","66");a.setAttribute("data-position","top left");a.src="http://huaban.com/js/pinmarklet.js?"+Math.floor(+new Date/10000000);var s=d.getElementsByTagName(t)[0];s.parentNode.insertBefore(a,s)};if(window.attachEvent){window.attachEvent("onload",function(){setTimeout(appendScript,1000)})}else{appendScript()}})(document,"script");</script>
{% endblock %}
{% block statsScript %}
{% autoescape off %}{{share.user.id|add_stats(share.user.username, '%sshare/detail/all/%s/' % (domain, share.id))}}{% endautoescape %}
{% endblock %}